
#ifndef __CMD_MNG_SESSION_HPP__
#define __CMD_MNG_SESSION_HPP__ 

#include "khan.hpp"
#include "vty.hpp"
#include "ipc_session.hpp"
#include "vty_ipc_msg.hpp"

class cmd_mng_session   /* FIXME: timer */
:public boost::enable_shared_from_this<cmd_mng_session>,
private boost::noncopyable       
{
public:
    cmd_mng_session(io_service& ioserv, const tcp_endpoint& rep);
    ~cmd_mng_session();

    tcp_socket& socket();
    bool connect();
    void disconnect() { PDBG("close socket\n");_socket.close(); }
    bool send_msg(vty_ipc_message_t& msg);
    bool recv_msg(vty_ipc_message_t& msg);

private:
    io_service& _ioserv;
    tcp_socket _socket;
    const tcp_endpoint _rep;
};

typedef boost::shared_ptr<cmd_mng_session> cmd_mng_session_ptr;

#endif
